Skip to content

Conversation

@Lash-L
Copy link
Collaborator

@Lash-L Lash-L commented Dec 10, 2025

The fix is the extra headers, it does not seem like any can be removed.

The api also accepts params or data, but data better aligns to the app, so we are switching to that.

home-assistant/core#158306

@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
roborock/web_api.py 51.31% <ø> (ø)

... and 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the V4 code login implementation to properly align with the Roborock app's authentication flow. The changes ensure the API requests match the expected format by switching from query parameters to form-encoded request body data and adding required headers.

  • Switched from params to data in both request_code_v4() and code_login_v4() functions to properly send data as form-encoded in the request body
  • Added additional required headers for V4 login including app version, phone system, phone model, and language settings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +323 to +328
"Content-Type": "application/x-www-form-urlencoded",
"header_clientlang": "en",
"header_appversion": "4.54.02",
"header_phonesystem": "iOS",
"header_phonemodel": "iPhone16,1",
},
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a comment explaining why these specific header values (Content-Type, language "en", phone system "iOS", phone model "iPhone16,1") are required for the V4 API. This would help future maintainers understand if these values need to be adjusted or made configurable.

Copilot uses AI. Check for mistakes.
"x-mercy-k": x_mercy_k,
"Content-Type": "application/x-www-form-urlencoded",
"header_clientlang": "en",
"header_appversion": "4.54.02",
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded app version "4.54.02" may become outdated as the Roborock app is updated. Consider adding a comment explaining why this specific version is used, or if possible, making it configurable to ensure future compatibility with the API.

Copilot uses AI. Check for mistakes.
@Lash-L Lash-L merged commit 2328d45 into main Dec 10, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants